home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
foscom.zip
/
FOSCOM.ASI
< prev
next >
Wrap
Text File
|
1991-10-13
|
7KB
|
366 lines
parse$=command$
GOSUB INITSYS:
loop:
gosub sendbyte:
gosub getbyte:
goto loop:
outloop:
GOSUB DTRDN:
GOSUB CLOSESYS:
END
SETPORT:
ah=&hex0000
al=&hex03
al=baudrate
gosub fixax:
pt=&hex0014
INT86(&HEX14,AX,NA,NA,DX,NA,NA,NA,NA,NA)
RETURN
ACTPORT:
ah=&hex04
al=&hex00
gosub fixax:
INT86(&HEX14,AX,BX,NA,DX,NA,NA,NA,NA,NA)
RETURN
DEACTPORT:
ah=&hex05
al=&hex00
gosub fixax:
INT86(&HEX14,AX,NA,NA,DX,NA,NA,NA,NA,NA)
RETURN
DTRUP:
ah=&hex06
al=&hex01
gosub fixax:
INT86(&HEX14,AX,NA,NA,DX,NA,NA,NA,NA,NA)
RETURN
DTRDN:
ah=&hex06
al=&hex00
gosub fixax:
INT86(&HEX14,AX,NA,NA,DX,NA,NA,NA,NA,NA)
RETURN
GETKEY:
A$=""
WHILE A$=""
A$=INKEY$
WEND
RETURN
INITSYS:
esc$=chr$(27)
cr$=chr$(13)
lf$=chr$(10)
bs$=chr$(8)
exit$=chr$(45)
hangup$=chr$(35)
formfeed$=chr$(12)
pgdn$=chr$(81)
pgup$=chr$(73)
off = 0
on = 1
gosub parsit:
port$=par$
gosub parsit:
baud$=par$
baud=val(baud$)
GOSUB PARSIT:
handshake$=par$
if port$="" then
cls
print "You did not enter the port, baudrate, and handshake information.";
print " If you ";
print "wish to do so from the command line, the syntax is:"
print
print " COMIN P BAUD HANDSHAKE"
print
print "Where:"
print " P is the Port Number (1 or 2)"
print " BAUD the desired Baud Rate...and"
print " HANDSHAKE is the desired Handshake type."
print " (NONE, XON, CTS, or BOTH"
print
print "NOTE that pressing Alt-X drop DTR and exit this program."
print " pressing Alt-H will drop DTR for 2 seconds (Hangup)."
print
print "--------------------------- MANUAL SETUP";
print " ---------------------------"
print
print "Port";
input port$
endif
if baud$="" then
print "Baud Rate";
input baud$
endif
if handshake$="CTS" then
a$="3"
endif
if handshake$="XON" then
a$="2"
endif
if handshake$="NONE" then
a$="1"
endif
if handshake$=""then
PRINT "Handshake"
print " 1. None"
print " 2. XON/XOFF"
print " 3. RTS/CTS"
print " Any other choice selects BOTH!"
print " Please make your selection...";
xon=on
cts=on
while a$=""
a$=inkey$
wend
else
if a$="1" then
xon=off
cts=off
endif
if a$="2" then
xon=on
cts=off
endif
if a$="3" then
xon=off
cts=on
endif
goto start:
endif
start:
port=val(port$)
baud=val(baud$)
if port = 1 then
dx=&hex0000
else
dx=&hex0001
endif
baudrate=&bin00000000
if baud = 19200 then
baudrate=&bin00000011
endif
if baud = 9600 then
baudrate=&bin11100011
endif
if baud = 4800 then
baudrate=&bin11000011
endif
if baud = 2400 then
baudrate=&bin10100011
endif
if baud = 1200 then
baudrate=&bin10000011
endif
if baud = 600 then
baudrate=&bin01100011
endif
if baud = 300 then
baudrate=&bin01000011
endif
cls
locate 1,26
print "Small FOSSIL Comm System"
GOSUB SETPORT:
GOSUB ACTPORT:
GOSUB HANDSHAKE:
GOSUB DTRUP:
RETURN
CLOSESYS:
GOSUB DEACTPORT:
RETURN
sendbyte:
k$=inkey$
if k$="" then around:
if extended = 1 then
gosub longstring:
goto around:
endif
al=asc(k$)
ah=&hex01
gosub fixax:
int86(&hex14,ax,na,na,dx,na,na,na,na,na)
around:
return
longstring:
k$=right$(k$,1)
if k$=exit$ then
gosub quit:
endif
if k$=hangup$ then
gosub dtrdn:
tim=30
k$=""
gosub wait:
gosub dtrup:
endif
if k$=pgdn$ then
gosub download:
endif
if k$=pgup$ then
gosub upload:
endif
return
download:
gosub commandenv:
call(envcheck$," /C zdown.bat")
return
upload:
gosub commandenv:
print "File(s) to send:";
input files$
filesend$=" /C zup.bat "+files$
call envcheck$,filesend$)
return
commandenv:
envcheck$="COMMAND.COM"
gosub envcheck:
envcheck$=envcheck$+"COMMAND.COM"
return
envcheck:
loopit:
temp$=environ$(1)
temp$=ucase$(temp$)
templen=len(temp$)
if temp$="" then
envcheck$="c:\"
return
endif
templen = len(envcheck$)
temp = instr(temp$,envcheck$)
if temp = 0 then loopit:
templen1=len(temp$)
templen1=templen1-templen
temp$=left$(temp$,templen1)
temp = instr(temp$,"=")
temp1 = len(temp$)
temp1 = temp1-temp
envcheck$ = right$(temp$,temp1)
envcheck$=ltrim$(envcheck$)
return
quit:
Print " Dropping DTR and exiting "
Print "Is this REALLY what you want to do (Y/n)? ";
gosub getkey:
a$=right$(a$,1)
a$=ucase$(a$)
if a$="Y" then
goto outloop:
else
cls
endif
return
getbyte:
ax=&hex2000
int86(&hex14,ax,na,na,dx,na,na,na,na,na)
if ax=&hexFFFF then skip:
s$=chr$(ax)
if s$=lf$ then skip:
if s$=formfeed$ then
cls
goto skip:
endif
if s$=cr$ then
print ""
else
ax=&hex1300
al=asc(s$)
ax=ax+al
int86(&hex14,ax,na,na,na,na,na,na,na,na)
endif
skip:
return
fixax:
ax=ah*&hex100
ax=ax+al
return
fixal:
al=ax*&hex100
al=ax/&hex100
return
fixah:
ah=ax/&hex100
return
backspace:
x=pos(0)
y=csrlin
xx=x-1
if xx<0 then
y=y-1
xx=79
if y < 1 then
y=1
xx=0
endif
endif
locate y,xx
print " ";
locate y,xx
return
wait:
stime&=timer
etime&=stime&+tim
while stime& < etime&
stime&=timer
wend
return
handshake:
al=&bin00000000
if xon = on then
al=al+&bin00000001
endif
if cts=on then
al=al+&bin00000010
endif
if txxon=on then
al=al+&bin00001000
endif
ah=&hex0F
gosub fixax:
int86(&hex14,AX,na,na,dx,na,na,na,na,na)
return
parsit:
par$=""
parse$=ltrim$(parse$)
parse=len(parse$)
if parse>0 then
tempspace=instr(parse$," ")
if tempspace < 1 then
tempspace=parse
endif
par$=left$(parse$,tempspace)
parse=parse-tempspace
parse$=right$(parse$,parse)
endif
par$=ucase$(par$)
par$=rtrim$(par$)
return